package com.wz.datachannel.util;

import java.util.Timer;
import java.util.TimerTask;

public class WzTimer {
	
	private Timer timer = new Timer();  
	
	public static interface TimeCall{
		public void OnTime(String tag);
	}
	public TimerTask startTask(final TimeCall call,final String tag,long time){
		
		TimerTask task = new TimerTask(){

			@Override
			public void run() {
				call.OnTime(tag);
			}
			
		};
		
		timer.schedule(task, time);
		
		return task;
		
	}
	
	public void close(){
		timer.cancel();
	}
}
